package com.yb.strategy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnWebApplication //web应该生效
@EnableConfigurationProperties(StrategyProperties.class)
public class StrategyAutoConfiguration {
    @Autowired
    StrategyProperties properties;

    @Bean("strategyService")
    public StrategyService helloService() {
        StrategyService service = new StrategyService();
        service.setProperties(properties);
        return service;
    }

}
